
from django.shortcuts import redirect,render
from django.db.models import Q
from app01 import models
from app01.utils.script.pager import Paginator

def my_transaction_list(request):
    keyword = request.GET.get('keyword', "").strip()
    con = Q()
    if keyword:
        con.connector = "OR"
        con.children.append(("charge_type__contains", keyword))
        con.children.append(("order_oid__contains", keyword))

    queryset = models.TransactionRecord.objects.filter(con).filter(customer_id=request.user.id,active=1).order_by('-id')
    pager = Paginator(request, queryset)
    context = {
        "pager": pager,
        "keyword": keyword
    }

    return render(request,"my_transaction.html",context)




